<?php
/**
 * 申请团长模块
 * wf
 * 2022/7/16
 */
namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use App\Repository\RepositoryInterface\HeadInterface;
use App\Repository\RepositoryInterface\HeadsInterface;
use Illuminate\Http\Request;

class HeadController extends Controller
{
    protected $head;

    public function __construct(HeadsInterface $heads){
        $this->head = $heads;
    }
    /**
     * 团长申请接口
     * @param Request $request
     * @return array
     */
    public function applyHead(Request $request){
        $params = $request->all();
        return $this->head->applyHead($params);
    }

    /**
     * 团长列表接口
     * @param Request $request
     * @return array
     */
    public function headList(Request $request){
        $params = $request->all();
        return  $this->head->headList($params);
    }

    /**
     * 审核状态列表接口
     * @param Request $request
     * @return array
     */
    public function headStatus(Request $request){
        $status = $request->input('status');
        return  $this->head->headStatus($status);
    }

    /**
     * 通过/不通过接口
     * @param Request $request
     * @return array
     */
    public function adopt(Request $request){
        $params = $request->all();
        return  $this->head->headList($params);
    }

    /**
     * 团长推荐
     * @param Request $request
     * @return mixed
     */
    public function recommendHead(Request $request){
        $params = $request->all();
        return $this->head->recommendHead($params);
    }
    /**
     * zyy
     * @param Request $request
     * @return mixed
     * 团长申请
     */
    public function findGroupData(Request $request){
        $uid = $request->post("uid");
        $groupCreate = $this->head->findGroupData($uid);
        return $groupCreate;
    }

    /**
     * zyy
     * @param Request $request
     * @return mixed
     * 团长地址
     */
    public function groupPath(Request $request){
        $token = $request->post("token");
        $groupPath = $this->head->groupPath($token);
        return $groupPath;
    }

    /**
     * zyy
     * @param Request $request
     * @return mixed
     * 团长地址添加
     */
    public function createGroupPath(Request $request){
        $groupAddPath = $request->post();
        $groupPath = $this->head->createGroupPath($groupAddPath);
        return $groupPath;
    }

    /**
     * zyy
     * @param Request $request
     * @return mixed
     * 团长限售商品
     */
    public function groupGoods(Request $request){
        $token = $request->post("token");
        $groupGoods = $this->head->groupGoods($token);
        return $groupGoods;
    }

    /**
     * zyy
     * @param Request $request
     * @return mixed
     * 团长设置团购商品
     */
    public function groupSetting(Request $request){
        $groupSetData = $request->post();
        $groupSetting = $this->head->groupSetting($groupSetData);
        return $groupSetting;
    }
}
